// ----------------------------------
// RSDK Project: Sonic 1/Sonic 2
// Script Description: Bomb Shrapnel Object
// Script Author: Christan Whitehead/Simon Thomley
// Unpacked by Rubberduckycooly's script unpacker
// ----------------------------------

//-------Aliases-------//
private alias 42 : TYPE_BOMBSHRAPNEL


// Static Values

// Tables

event ObjectMain
	object.xpos += object.xvel
	object.ypos += object.yvel
	object.yvel += 0x1800
	temp1 = 0
	temp0 = object.xpos
	temp0 >>= 16
	temp0 -= screen.cameraX
	Abs(temp0)
	temp0 -= 16
	if temp0 <= screen.xcenter
		temp0 = object.ypos
		temp0 >>= 16
		temp0 -= screen.cameraY
		Abs(temp0)
		temp0 -= 16
		if temp0 <= screen.ycenter
			temp1 = 1
		end if
	end if
	if temp1 == 0
		object.type = TypeName[Blank Object]
	end if
	foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
		BoxCollisionTest(C_TOUCH, object.entityPos, -6, -6, 6, 6, currentPlayer, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO)
		if checkResult == 1
			CallFunction(PlayerObject_ProjectileHit)
		end if
	next
	object.frame = object.animationTimer
	object.frame >>= 2
	object.animationTimer++
	object.animationTimer &= 7
end event


event ObjectDraw
	DrawSprite(object.frame)
end event


event ObjectStartup
	CheckCurrentStageFolder("Zone05")
	if checkResult == 1
		LoadSpriteSheet("SLZ/Objects.gif")
		SpriteFrame(-4, -4, 8, 8, 67, 170)
		SpriteFrame(-4, -4, 8, 8, 67, 179)
	end if
	CheckCurrentStageFolder("Zone17")
	if checkResult == 1
		LoadSpriteSheet("SBZ/Objects.gif")
		SpriteFrame(-4, -4, 8, 8, 66, 79)
		SpriteFrame(-4, -4, 8, 8, 66, 88)
	end if
	CheckCurrentStageFolder("Zone07")
	if checkResult == 1
		LoadSpriteSheet("MBZ/Objects.gif")
		SpriteFrame(-4, -4, 8, 8, 67, 367)
		SpriteFrame(-4, -4, 8, 8, 67, 376)
	end if
end event

event RSDKDraw
	DrawSprite(0)
end event

event RSDKLoad
	LoadSpriteSheet("Global/Display.gif")
	SpriteFrame(-16, -16, 32, 32, 1, 143)
end event
